package com.service.Impl;

import com.dao.CommentDao;
import com.mypg.Comment;
import com.service.CommentService;

import java.sql.Timestamp;
import java.util.List;

public class CommentServiceImpl implements CommentService {

    private CommentDao commentDao;

    public CommentServiceImpl(){}
    public CommentServiceImpl(CommentDao commentDao) {
        this.commentDao = commentDao;
    }

    @Override
    public List<Comment> selectAllComment() {
        return commentDao.selectAllComment();
    }

    @Override
    public int selectComment_count() {
        return commentDao.selectComment_count();
    }

    @Override
    public Comment selectCommentByComment_id(int comment_id) {
        return commentDao.selectCommentByComment_id(comment_id);
    }

    @Override
    public List<Comment> selectComment_for_comment_table_jsp(String user_nickname, int question_id, Timestamp time_start, Timestamp time_end,
                                                             int start_row,int page_nums) {
        return commentDao.selectComment_for_comment_table_jsp(user_nickname,question_id,time_start,time_end,
                start_row,page_nums);
    }

    @Override
    public int selectComment_count_For_comment_table_jsp(String user_nickname, int question_id, Timestamp time_start, Timestamp time_end) {
        return commentDao.selectComment_count_For_comment_table_jsp(user_nickname,question_id,time_start,time_end);
    }

    @Override
    public List<Comment> selectCommentByQuestion_id(int question_id) {
        return commentDao.selectCommentByQuestion_id(question_id);
    }

    @Override
    public void deleteCommentByComment_id(int comment_id) {
        commentDao.deleteCommentByComment_id(comment_id);
    }

    @Override
    public void insertComment(Comment comment) {
        commentDao.insertComment(comment);
    }

    @Override
    public void updateComment_valueByComment_id(int comment_id, int comment_value) {
        commentDao.updateComment_valueByComment_id(comment_id,comment_value);
    }

    public CommentDao getCommentDao() {
        return commentDao;
    }

    public void setCommentDao(CommentDao commentDao) {
        this.commentDao = commentDao;
    }


}
